package jsyf.oa.web.report.newAppReport;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.report.newAppReport.NewAppReportForGroupFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "全新的APP报表FOR集团", description = "全新的APP报表FOR集团")
@Controller
@RequestMapping("/newAppReportForGroup")
public class NewAppReportForGroupController {

    @Resource
    private NewAppReportForGroupFacade newAppReportForGroupFacade;

    @RequestMapping(value = "/getBRMEmailForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理工作报告",
            notes = "大区经理工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getBRMEmailForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getBRMEmailForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getRDEmailForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域总监工作报告",
            notes = "区域总监工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getRDEmailForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getRDEmailForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSDEmailForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "销售总监工作报告",
            notes = "销售总监工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getSDEmailForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getSDEmailForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getRegionIdByUserIdForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取区域",
            notes = "获取区域",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getRegionIdByUserIdForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getRegionIdByUserIdForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getEmailByUserIdForRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域经理工作报告",
            notes = "区域经理工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getEmailByUserIdForRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getEmailByUserIdForRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getZJLEmailForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "总经理工作报告",
            notes = "总经理工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getZJLEmailForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getZJLEmailForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getEmailByUserIdForRTL.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域组长工作报告",
            notes = "区域组长工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getEmailByUserIdForRTL(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getEmailByUserIdForRTL(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @ResponseBody
    @RequestMapping(value = "/getTodayPlanByUserIdAndDateTimeForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日第二天计划",
            notes = "今日第二天计划",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodayPlanByUserIdAndDateTimeForGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getTodayPlanByUserIdAndDateTimeForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getBRMTodayFirstVisitAndSignForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理首次面访",
            notes = "大区经理首次面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getBRMTodayFirstVisitAndSignForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getBRMTodayFirstVisitAndSignForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTodayFirstVisitAndSignForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理下属首次面访",
            notes = "大区经理下属首次面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodayFirstVisitAndSignForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getTodayFirstVisitAndSignForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getBRMVisitByUserIdAndDateTimeForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理今日面电访",
            notes = "大区经理今日面电访",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd',type//0-电/1-面,status//0-AM/1-PM}", dataType = "String", paramType = "body")
    })
    public void getBRMVisitByUserIdAndDateTimeForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getBRMVisitByUserIdAndDateTimeForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getRMVisitByUserIdAndDateTimeForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域经理今日面电访",
            notes = "区域经理今日面电访",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd',type//0-电/1-面,status//0-AM/1-PM}", dataType = "String", paramType = "body")
    })
    public void getRMVisitByUserIdAndDateTimeForGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getRMVisitByUserIdAndDateTimeForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }


    @RequestMapping(value = "/getSignByUserIdAndDateTimeForTopGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "总经理考勤",
            notes = "总经理考勤",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForTopGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getSignByUserIdAndDateTimeForTopGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSignByUserIdAndDateTimeForZJGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域总监考勤",
            notes = "区域总监考勤",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForZJGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getSignByUserIdAndDateTimeForZJGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSignByUserIdAndDateTimeForBigRegionGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理考勤",
            notes = "大区经理考勤",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForBigRegionGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getSignByUserIdAndDateTimeForBigRegionGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSignByUserIdAndDateTimeForZZGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域组长考勤",
            notes = "区域组长考勤",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForZZGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getSignByUserIdAndDateTimeForZZGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSignByUserIdAndDateTimeForRegionGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域经理考勤",
            notes = "区域经理考勤",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForRegionGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getSignByUserIdAndDateTimeForRegionGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getCostByUserIdAndDateTimeForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日费用",
            notes = "今日费用",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getCostByUserIdAndDateTimeForGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getCostByUserIdAndDateTimeForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @ResponseBody
    @RequestMapping(value = "/getRSEmailForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域支持工作报告",
            notes = "区域支持工作报告",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getRSEmailForGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getRSEmailForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @ResponseBody
    @RequestMapping(value = "/getXMEmailForGroup.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "销售管理工作报告",
            notes = "销售管理工作报告",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getXMEmailForGroup(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForGroupFacade.getXMEmailForGroup(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

}
